<template>
  <div class="ai-tools-bg">
    <!-- 顶部：和主导航一致，极简风格 -->
    <!-- 聊天头部 -->
    <div class="ai-tools-header">
      <div class="header-content">
        <div class="header-left">
          <img src="/src/assets/AI工具箱.png" class="ai-tools-logo" alt="AI助手" />
          <div class="header-info">
            <h2>AI工具箱</h2>
            <span class="status">
              <span class="status-dot"></span>
              部分正在开发中，敬请期待！
            </span>
          </div>
        </div>
        <div class="header-right">
          <a-tooltip title="功能说明">
            <a-button type="text" class="action-btn">
              <template #icon><ToolOutlined /></template>
            </a-button>
          </a-tooltip>
        </div>
      </div>
    </div>
    <div class="ai-tools-main ai-tools-main-glass ai-tools-main-flat">
      <div v-for="group in toolGroups" :key="group.title" class="ai-tool-group">
        <div class="ai-tool-group-title">{{ group.title }}</div>
        <div class="ai-tool-group-grid">
          <div
            v-for="tool in group.tools"
            :key="tool.key"
            class="ai-tool-modern-card glass-card"
            :style="{ background: tool.bg }"
          >
            <div class="modern-card-icon-glow">
              <div class="modern-card-icon-circle">
                <component :is="tool.icon" />
              </div>
              <span v-if="tool.tag" class="modern-card-tag">{{ tool.tag }}</span>
            </div>
            <div class="modern-card-info">
              <div class="modern-card-title">{{ tool.title }}</div>
              <div class="modern-card-desc">{{ tool.desc }}</div>
            </div>
            <a-button type="primary" class="modern-card-btn-glass" disabled>敬请期待</a-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  import {
    PictureOutlined,
    FileTextOutlined,
    FileSearchOutlined,
    EditOutlined,
    HighlightOutlined,
    FileProtectOutlined,
    FileImageOutlined,
    FileSyncOutlined,
    FileZipOutlined,
    FileWordOutlined,
    FilePptOutlined,
    FileExcelOutlined,
    FilePdfOutlined,
    FileGifOutlined,
    FileJpgOutlined,
    FileAddOutlined,
    BulbOutlined,
    RocketOutlined,
    ToolOutlined,
    SmileOutlined,
  } from '@ant-design/icons-vue'

  const toolGroups = [
    {
      title: '图片智能处理',
      tools: [
        {
          key: 'outpaint',
          icon: PictureOutlined,
          title: 'AI图片扩图',
          desc: '智能补全图片边缘，提升分辨率',
          bg: 'linear-gradient(135deg, #38bdf8cc 0%, #6366f1cc 100%)',
          tag: '热门',
        },
        {
          key: 'img2text',
          icon: FileTextOutlined,
          title: '图片转文字',
          desc: 'OCR智能识别图片中的文字内容',
          bg: 'linear-gradient(135deg, #fbbf24cc 0%, #f472b6cc 100%)',
        },
        {
          key: 'imgcompress',
          icon: FileZipOutlined,
          title: 'AI图片压缩',
          desc: '智能无损压缩图片，节省空间',
          bg: 'linear-gradient(135deg, #60a5facc 0%, #fbbf24cc 100%)',
        },
        {
          key: 'imgtag',
          icon: HighlightOutlined,
          title: 'AI图片打标签',
          desc: '自动识别图片内容并生成标签',
          bg: 'linear-gradient(135deg, #fbbf24cc 0%, #38bdf8cc 100%)',
        },
        {
          key: 'imgwatermark',
          icon: FileProtectOutlined,
          title: 'AI图片去水印',
          desc: '智能去除图片水印',
          bg: 'linear-gradient(135deg, #f87171cc 0%, #6366f1cc 100%)',
        },
        {
          key: 'imgenhance',
          icon: BulbOutlined,
          title: '图片增强美化',
          desc: 'AI自动提升图片清晰度、色彩',
          bg: 'linear-gradient(135deg, #34d399cc 0%, #f472b6cc 100%)',
          tag: '新',
        },
        {
          key: 'img2img',
          icon: FileJpgOutlined,
          title: 'AI图像风格迁移',
          desc: '上传图片，AI帮你变换风格',
          bg: 'linear-gradient(135deg, #6366f1cc 0%, #34d399cc 100%)',
        },
        {
          key: 'gifgen',
          icon: FileGifOutlined,
          title: 'GIF动图生成',
          desc: '多张图片一键生成GIF动图',
          bg: 'linear-gradient(135deg, #38bdf8cc 0%, #f87171cc 100%)',
        },
      ],
    },
    {
      title: '文件智能管理',
      tools: [
        {
          key: 'imgmanage',
          icon: FileImageOutlined,
          title: '智能图片管理',
          desc: '自动分类、标签、查重、智能搜索',
          bg: 'linear-gradient(135deg, #f472b6cc 0%, #818cf8cc 100%)',
        },
        {
          key: 'filemanage',
          icon: FileSyncOutlined,
          title: '智能文件管理',
          desc: 'AI自动整理、归档、查找文件',
          bg: 'linear-gradient(135deg, #f87171cc 0%, #fbbf24cc 100%)',
        },
        {
          key: 'imgsearch',
          icon: FileSearchOutlined,
          title: '图片智能搜索',
          desc: '以图搜图、关键词、标签等多种方式',
          bg: 'linear-gradient(135deg, #818cf8cc 0%, #34d399cc 100%)',
          tag: 'AI',
        },
        {
          key: 'aiconvert',
          icon: FileAddOutlined,
          title: '格式智能转换',
          desc: '图片、文档、音视频等多格式互转',
          bg: 'linear-gradient(135deg, #f87171cc 0%, #60a5facc 100%)',
        },
      ],
    },
    {
      title: '内容生成与办公',
      tools: [
        {
          key: 'textgen',
          icon: EditOutlined,
          title: 'AI文字生成',
          desc: '输入提示词，AI帮你生成高质量文本',
          bg: 'linear-gradient(135deg, #34d399cc 0%, #60a5facc 100%)',
        },
        {
          key: 'docgen',
          icon: FileWordOutlined,
          title: 'AI文档生成',
          desc: '结构化数据自动生成Word、PDF等文档',
          bg: 'linear-gradient(135deg, #6366f1cc 0%, #fbbf24cc 100%)',
        },
        {
          key: 'pptgen',
          icon: FilePptOutlined,
          title: 'AI PPT生成',
          desc: '输入大纲，AI帮你生成精美PPT',
          bg: 'linear-gradient(135deg, #f472b6cc 0%, #f87171cc 100%)',
        },
        {
          key: 'excelgen',
          icon: FileExcelOutlined,
          title: 'AI表格生成',
          desc: '结构化数据一键生成Excel表格',
          bg: 'linear-gradient(135deg, #34d399cc 0%, #fbbf24cc 100%)',
        },
        {
          key: 'pdfocr',
          icon: FilePdfOutlined,
          title: 'PDF智能识别',
          desc: 'PDF文档内容智能提取、OCR识别',
          bg: 'linear-gradient(135deg, #818cf8cc 0%, #fbbf24cc 100%)',
        },
        {
          key: 'aiqa',
          icon: SmileOutlined,
          title: 'AI问答助手',
          desc: '智能问答、知识库检索',
          bg: 'linear-gradient(135deg, #fbbf24cc 0%, #34d399cc 100%)',
          tag: '推荐',
        },
        {
          key: 'aiplan',
          icon: RocketOutlined,
          title: 'AI自动规划',
          desc: '智能日程、任务、项目自动规划',
          bg: 'linear-gradient(135deg, #38bdf8cc 0%, #818cf8cc 100%)',
        },
        {
          key: 'aicustom',
          icon: ToolOutlined,
          title: '自定义AI工具',
          desc: '支持自定义AI流程，满足个性化需求',
          bg: 'linear-gradient(135deg, #818cf8cc 0%, #f472b6cc 100%)',
        },
      ],
    },
  ]
</script>

<style scoped>
  .ai-tools-header {
    padding: 16px 24px;
    background: var(--theme-surface);
    border-bottom: 1px solid var(--theme-border);
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 10;
    box-shadow: 0 2px 4px var(--theme-shadow);
    transition: all 0.3s ease;
  }
  .ai-tools-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .header-content {
    max-width: 1200px;
    height: 50px;

    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .ai-tools-bg {
    min-height: 100vh;
    background: var(--theme-background);
    padding-bottom: 48px;
    transition: all 0.3s ease;
  }
  .ai-tools-header-flat {
    position: sticky;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 100;
    background: var(--theme-surface);
    border-bottom: 1px solid var(--theme-border);
    box-shadow: none;
    padding: 0;
    transition: all 0.3s ease;
  }
  .ai-tools-header-content-flat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 32px;
    height: 54px;
    min-height: 54px;
    max-width: 1400px;
    margin: 0 auto;
  }
  .ai-tools-logo-flat {
    width: 32px;
    height: 32px;
    display: block;
  }
  .ai-tools-title-flat {
    font-size: 20px;
    font-weight: 700;
    color: var(--theme-text);
    letter-spacing: 1px;
    transition: color 0.3s ease;
  }
  .ai-tools-main-flat {
    padding-top: 32px !important;
  }
  .ai-tools-header-absolute {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 100;
    background: linear-gradient(90deg, #38bdf8 0%, #6366f1 100%);
    box-shadow: 0 2px 16px 0 rgba(56, 189, 248, 0.12);
    backdrop-filter: blur(8px);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
  }
  .ai-tools-header-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 48px 18px 48px;
    max-width: 1400px;
    margin: 0 auto;
  }
  .ai-tools-logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
  }
  .ai-tools-logo {
    width: 48px;
    height: 48px;
    display: block;
  }
  .ai-tools-title-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .ai-tools-title-group h2 {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 2px 0;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px #38bdf880;
  }
  .ai-tools-slogan {
    font-size: 16px;
    color: #e0e7ef;
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: 0 1px 4px #6366f180;
  }
  .ai-tools-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 120px 32px 0 32px;
  }
  .ai-tools-main-glass {
    backdrop-filter: blur(2px);
  }
  .ai-tool-group {
    margin-bottom: 48px;
  }
  .ai-tool-group-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: 24px;
    letter-spacing: 1px;
    padding-left: 8px;
    transition: color 0.3s ease;
  }
  .ai-tool-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
  }
  .glass-card {
    border-radius: 32px;
    box-shadow: 0 8px 32px 0 var(--theme-shadow);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 40px 32px 32px 32px;
    position: relative;
    min-height: 240px;
    overflow: hidden;
    transition:
      box-shadow 0.2s,
      transform 0.2s,
      border 0.2s;
    background-clip: padding-box;
    border: 2.5px solid var(--theme-border);
    backdrop-filter: blur(12px) saturate(1.2);
    background-size: 200% 200%;
    background-position: 0 0;
    cursor: pointer;
  }
  .glass-card:hover {
    box-shadow: 0 16px 48px 0 var(--theme-shadow);
    transform: translateY(-8px) scale(1.05);
    border: 2.5px solid var(--theme-primary);
    background-position: 100% 100%;
  }
  .modern-card-icon-glow {
    position: relative;
    margin-bottom: 18px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modern-card-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--theme-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--theme-text);
    box-shadow:
      0 0 24px 0 var(--theme-shadow),
      0 2px 8px var(--theme-shadow);
    transition: box-shadow 0.2s;
  }
  .glass-card:hover .modern-card-icon-circle {
    box-shadow:
      0 0 32px 8px var(--theme-shadow),
      0 2px 8px var(--theme-shadow);
  }
  .modern-card-tag {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(90deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: var(--theme-surface);
    font-size: 12px;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 12px;
    box-shadow: 0 2px 8px var(--theme-shadow);
    letter-spacing: 1px;
    z-index: 2;
    transition: all 0.3s ease;
  }
  .modern-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: 8px;
    letter-spacing: 1px;
    transition: color 0.3s ease;
  }
  .modern-card-desc {
    color: var(--theme-textSecondary);
    font-size: 16px;
    margin-bottom: 18px;
    min-height: 36px;
    transition: color 0.3s ease;
  }
  .modern-card-btn-glass {
    margin-top: auto;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    background: var(--theme-primary);
    color: var(--theme-surface);
    border: none;
    box-shadow: 0 2px 8px var(--theme-shadow);
    padding: 0 36px;
    height: 44px;
    transition: all 0.2s;
    letter-spacing: 1px;
  }
  .modern-card-btn-glass:disabled {
    background: var(--theme-border);
    color: var(--theme-textSecondary);
    cursor: not-allowed;
  }
  .modern-card-btn-glass:not(:disabled):hover {
    background: var(--theme-secondary);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 24px var(--theme-shadow);
  }
  /* 深色主题特殊处理 */
  [data-theme="dark"] .glass-card {
    border-color: var(--theme-border);
  }

  [data-theme="dark"] .glass-card:hover {
    border-color: var(--theme-primary);
  }

  [data-theme="dark"] .modern-card-icon-circle {
    background: var(--theme-background);
    color: var(--theme-text);
  }

  [data-theme="dark"] .modern-card-title {
    color: var(--theme-text);
  }

  [data-theme="dark"] .modern-card-desc {
    color: var(--theme-textSecondary);
  }
  @media (max-width: 900px) {
    .ai-tools-header-content {
      padding: 18px 12px 12px 12px;
      gap: 12px;
    }
    .ai-tools-logo-box {
      width: 40px;
      height: 40px;
      border-radius: 10px;
    }
    .ai-tools-logo {
      width: 28px;
      height: 28px;
    }
    .ai-tools-title-group h2 {
      font-size: 18px;
    }
    .ai-tools-slogan {
      font-size: 12px;
    }
    .ai-tools-main {
      padding: 90px 8px 0 8px;
    }
    .ai-tool-group-title {
      font-size: 16px;
      margin-bottom: 12px;
    }
    .ai-tool-group-grid {
      gap: 14px;
    }
    .glass-card {
      padding: 16px 8px 10px 8px;
      min-height: 100px;
      border-radius: 12px;
    }
    .modern-card-icon-glow {
      width: 32px;
      height: 32px;
      margin-bottom: 8px;
    }
    .modern-card-icon-circle {
      width: 28px;
      height: 28px;
      font-size: 16px;
      border-radius: 6px;
    }
    .modern-card-title {
      font-size: 13px;
    }
    .modern-card-desc {
      font-size: 11px;
      min-height: 12px;
    }
    .modern-card-btn-glass {
      font-size: 11px;
      height: 24px;
      padding: 0 8px;
      border-radius: 6px;
    }
    .modern-card-tag {
      font-size: 10px;
      padding: 1px 6px;
      top: -4px;
      right: -4px;
    }
  }
</style>
